<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>.eunit/clock.COVER.html</title>
</head><body style='background-color: white; color: black'>
<pre>
File generated from d:/dev/workspace/usharp/usharp-erlang/.eunit/clock.erl by COVER 2013-06-16 at 07:34:02

****************************************************************************

        |  %% Author: jafu
        |  %% Created: 2013-6-16
        |  %% Description: TODO: Add description to clock
        |  -module(clock).
        |  
        |  %%
        |  %% Include files
        |  %%
        |  
        |  %%
        |  %% Exported Functions
        |  %%
        |  -export([start/2,stop/0]).
        |  
        |  %%
        |  %% API Functions
        |  %%
        |  
        |  start(Time,Fun) -&gt;
     2..|  	case whereis(clock) of
        |  		undefined -&gt;
     1..|  			register(clock,spawn(fun() -&gt; tick(Time,Fun) end) );
        |  		_Any -&gt;
     1..|  			started
        |  	end.
        |  stop() -&gt;
     2..|  	case whereis(clock) of
        |  		undefined -&gt;
     1..|  			not_start;
        |  		_Any -&gt;
     1..|  			clock ! stop
        |  	end.
        |  
        |  %%
        |  %% Local Functions
        |  %%
        |  
        |  tick(Time,Fun) -&gt;
     2..|  	receive
        |  		stop -&gt;
     1..|  			void
        |  	after Time -&gt;
     1..|  			Fun(),
     1..|  			tick(Time,Fun)
        |  	end.
</pre>
</body>
</html>
